package com.tcoiss.job.jobhandler.bill;

import com.tcoiss.common.component.api.RemoteLogService;
import com.tcoiss.common.core.web.domain.AjaxResult;
import com.tcoiss.job.jobhandler.base.CommonJob;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class KdDataJob extends CommonJob {
    @Resource
    private RemoteLogService remoteLogService;

    @XxlJob("salePlan")
    public ReturnT<String> salePlanJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }

    @XxlJob("financeBill")
    public ReturnT<String> financeBillJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }

    @XxlJob("salespolicyReport")
    public ReturnT<String> salespolicyReportJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }

    @XxlJob("saleCk")
    public ReturnT<String> saleCkJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }

    @XxlJob("purchaseOrder")
    public ReturnT<String> purchaseOrderJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }


    @XxlJob("flowHistoryrp")
    public ReturnT<String> flowHistoryrpJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }


    @XxlJob("retailMX")
    public ReturnT<String> lskdJobHandler(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }


    @XxlJob("retailBill")
    public ReturnT<String> retailBillJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }

    @XxlJob("materialBase")
    public ReturnT<String> materialBaseJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }


    @XxlJob("starBase")
    public ReturnT<String> storeSalePlanJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);

    }


    @XxlJob("personBase")
    public ReturnT<String> personBaseJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }


    @XxlJob("orgBase")
    public ReturnT<String> orgBaseJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }


    @XxlJob("stockBase")
    public ReturnT<String> stockBaseJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }

    /**
     *库房数量清单同步
     * @param jobParam
     * @return
     * @throws Exception
     */
    @XxlJob("inventorylistrpJob")
    public ReturnT<String> inventorylistrpJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }

    /**
     *发货单
     * @param jobParam
     * @return
     * @throws Exception
     */
    @XxlJob("InvoiceBill")
    public ReturnT<String> invoiceBillJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }

    /**
     *采购入库单
     * @param jobParam
     * @return
     * @throws Exception
     */
    @XxlJob("purinbill")
    public ReturnT<String> purinbillJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }

    /**
     *其他出入库
     * @param jobParam
     * @return
     * @throws Exception
     */
    @XxlJob("otherOutorin")
    public ReturnT<String> otherOutorinJob(String jobParam) throws Exception {
        return super.commonJobHandler(jobParam);
    }

    /**
     *方案执行信息预警
     * @param param
     * @return
     * @throws Exception
     */
    @XxlJob("checkSchemeJob")
    public ReturnT<String> checkSchemeJob(String param) throws Exception {
        XxlJobLogger.log("发送方案日志失败信息");
        AjaxResult result = remoteLogService.checkSchemeLog();
        if(result != null){
            if("200".equals(result.get("code"))){
                return ReturnT.SUCCESS;
            }
        }
        return ReturnT.FAIL;
    }

}
